<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue 源码分析</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    #app {
      width: 400px;
      margin: auto;
      margin-top: 20px;
      padding: 5px 20px 15px;
      border: 1px solid #ccc;
      border-radius: 5px;
    }
    ul {
      padding: 5px 10px;
      border-top: 1px solid #ccc;
      border-bottom: 1px solid #ccc;
      margin: 15px 0 10px;
    }
    .person {
      border-bottom: 1px solid #ccc;
      padding-bottom: 10px;
      margin-bottom: 10px;
    }
  </style>
</head>
<body>
  <div id='app'>
    <h3 v-text='title'></h3>
    <div v-text='text'></div>
    <div v-html='html'>2</div>
    <input type="text" v-model='inputMsg'>
    <ul>
      <li>1</li>
      <li>{{inputMsg}}</li>
      <li>3</li>
    </ul>
    <div class='person'>
      <p>{{person.name}}</p>
      <p>{{person.sex}}</p>
    </div>
    <button v-on:click='clickBtn1'>事件v-on</button>
    <button @click='clickBtn2'>事件@</button>
  </div>

  <script src='./js/observer.js'></script>
  <script src='./js/index.js'></script>
  <script>
    let qb = new Qb_Vue({
      el: '#app',
      data() {
        return {
          title: 'mvvm---原理解析',
          text:'指令v-text绑定',
          html:'<h5>指令v-html绑定</h5>',
          inputMsg: 'v-model绑定',
          person: {
            name: 'Json',
            sex: '男'
          }
        }
      },
      // data: {
      //   title: 'mvvm---原理解析',
      //   text:'指令v-text绑定',
      //   html:'<h5>指令v-html绑定</h5>',
      //   inputMsg: 'v-model绑定',
      //   person: {
      //     name: 'Json',
      //     sex: '男'
      //   }
      // },
      methods: {
        clickBtn1() {
          console.log(this)
          this.person.name = 'jet'
          //this.$data.person.name = 'jet'
        },
        clickBtn2() {
          console.log(this)
        }
      },
    })
  </script>
  
</body>
</html>